<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>控制器</title>
    <script src="../js/angular.min.js"></script>
</head>
<body>
<!--第一种方法-->
<!--
<div ng-app="myApp" ng-controller="myCtrl">
    名：<input ng-model="firstName"><br>
    姓：<input ng-model="lastName"><br>
    姓名：{{firstName+" "+lastName}}
</div>
<script>
    var app=angular.module('myApp',[]);
    app.controller("myCtrl", function ($scope) {
        $scope.firstName="John";
        $scope.lastName="Doe";
    });
</script>
-->

<!--第二种方法-->
<!--<div ng-app="myApp" ng-controller="myCtrl">
    名：<input ng-model="firstName">
    姓：<input ng-model="lastName">
    姓名：{{fullName}}
   &lt;!&ndash; 姓名：{{fullName()}}&ndash;&gt;
</div>
<script >
    var app =angular.module("myApp",[]);
    app.controller("myCtrl", function ($scope) {
        $scope.firstName="John";
        $scope.lastName="Doe";
        $scope.fullName= $scope.firstName+" "+$scope.lastName

       /* $scope.fullName= function () {
         return $scope.firstName+" "+$scope.lastName
        }*/
    });
</script>-->

<!--外部文件控制器-->

<!--<div ng-app="myApp" ng-controller="myCtrl">
    &lt;!&ndash;名：<input ng-model="firstName">
    姓：<input  ng-model="lastName">&ndash;&gt;
    姓名：{{fullName()}}
</div>
<script src="personName.js"></script>-->

<!--循环对象数组-->
<!--
<div ng-app=""  ng-init="person=[
{name:'changjing',city:'jiangsu'},
{name:'xiaowen',city:'jiangsu'},
{name:'lanlan',city:'anhui'}
]
">
    <ul>
        <li ng-repeat="x in person">{{x.name+" "+x.city}}</li>
    </ul>
</div>
-->

<div ng-app="myApp" ng-controller="myCtrl">
    <ul>
        <li ng-repeat="x in person">{{x.name+" "+x.city}}</li>
    </ul>
</div>
<script>
    var app=angular.module("myApp",[]);
    app.controller("myCtrl", function ($scope) {
        $scope.person=[
            {name:'changjing',city:'jiangsu'},
            {name:'xiaowen',city:'jiangsu'},
            {name:'lanlan',city:'anhui'}];
    });

</script>






















</body>
</html>